<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<#include "/common/plateform/include/common-base.ftl">
  <title>模块管理</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>

<!-- 以下是body主体内容的模块区域 -->
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

  <!-- top start -->
	<#include "/common/plateform/top.ftl">
  <!-- top end -->
  <!-- left start -->
	<#include "/common/plateform/left-project.ftl">
  <!-- left end-->

  <div class="content-wrapper">
  

    <!-- Main start -->
	<section class="content">
      <div class="row">
        <div class="col-xs-12">
        
          <!------搜索  start ------->
          <div class="box box-info hidden">
             <!--搜索title  start -->
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-search"></i> 搜索查询</h3>
                 <div class="box-tools pull-right">
	                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
                 </div>
              </div>
            <!--搜索title  end -->
           <div class="box-body">
			  <form id="searchForm" class="form-horizontal" action="javascript:;">
				<input type="hidden" name="pageName" value="sysModule-list">
				<input type="hidden" name="formName" value="searchForm">
				<input type="hidden" name="sysModule.w_delStatus" value="F">
				<input type="hidden" name="sysModule.w_fatherId" value="0">
				<input type="hidden" name="sysModule.w_sysName" value="">

				  <select id="searchForm_sysName" readonly="readonly"
						  class="form-control  clean"
						  data-dict-code="dymicSql" data-dict-cate=""
						  data-colmun="{value:'sysEname',text:'sysCname'}"
						  data-obj-name="uctSys" data-page-name="uct-sys"
						  data-form-name="searchForm"
						  data-type-tag="select" data-def="">
					  <option value="">--请选择--</option>
				  </select>

				  <input type="hidden" name="sysModule.w_code" value="${code!''}">
				  <#if (database_type =='oracle')>
				  	<input type="hidden" name="orderBy" value="sysModule.if_show desc,sysModule.num asc,to_number(sysModule.order_no) asc">
			      </#if>
				   <#if (database_type =='mysql')>
			   		<input type="hidden" name="orderBy" value="sysModule.if_show desc,sysModule.num asc, sysModule.order_no+0 asc">
				   </#if>

					   <div class="col-sm-2 text_r"><label class="control-label" >菜单名称：</label></div>
						<div class="col-sm-2">
						 <input type="text" class="form-control clean"  name="sysModule.wl_title" value=""/>
						</div>
				<center>
				   <div class="box-footer clearfix">
				       <button type="button" class="btn btn-success" onclick="getTableData();"><i class="fa fa-search"></i> 查询</button> 
				       <button  type="button" class="btn btn-warning" onclick="mytools.cleanData('#searchForm');">重置 </button>
				   </div>
				</center>
			  </form>
			  </div>




	     </div>
	     <!------- 搜索 end -------->
           
        <!------- 列表 start -------->
          <div class="box box-success">
            <!--列表title  start --> 
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-table"></i> 系统菜单管理
				 <#if !(ifShow??)>
					 <button  class="btn btn-default hidden" type="button" onclick="toAdd('parent');"><i class="fa fa-plus-circle"></i> 增加主菜单</button>
				 </#if>
		         <button data-step="2" data-intro="点此按钮增加二级功能菜单后。列表内再次展开至二级功能菜单，先点[创建生成策略]按钮，完成后再点击[表单设计器]按钮。" id="btn-add-child" class="btn btn-primary" type="button" onclick="toAdd('child');"><i class="fa fa-plus-circle"></i> 增加子菜单</button>
		         
		        <button class="btn btn-danger hidden" id="openDrag" type="button" onclick="openDrag('dataList-body')" >开启拖拽</button>
				<button class="btn btn-danger hidden" id="closeDrag" type="button" onclick="closeDrag('dataList-body')" disabled="disabled">关闭拖拽</button>
		         
                 </h3>
                 <div class="box-tools pull-right">
	                 　　　　　　　　<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
	                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                 </div>
              </div>
            <!--列表title  end --> 
              <div class="box-body">
                <table id="dataList" class="table table-bordered table-hover" >
                <thead class="bg-success">
                <tr>
                        <th>名称</th>
                        <th>标识</th>
                        <th>序号/图标</th>
                        <th>级别/显示 </th>
                  		<th>操作</th>
                </tr>
                </thead>
                <tbody id="dataList-body">
                </tbody>
              </table>
              <center>
    	  		<ul id="dataList-page"></ul>
              </center>
            </div>
           </div>
        <!------- 列表 end -------->
        </div>
      </div>
    </section>
    <!-- Main end -->
    
<div class="modal fade" id="my_modal_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 900px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red"><span id="span-module-no-text"></span>添加 <span id="span-module-add-title" class="ml20"></span></font> 
						</h4>
					</div>

					<div class="modal-body">
						<form class="form-horizontal" role="form" id="addForm" action="javascript:void(0);">
							<input type="hidden" id="addForm_formToken" name="formToken" >
							<input type="hidden" name="pageName"  value="sysModule-list">
							<input type="hidden" name="formName"  value="addForm">
							<input type="hidden" name="sysModule.delStatus" value="F">
							
							<input type="hidden"  name="sysModule.tempName" id="addForm_tempName" value=""/>
					        <input type="hidden"  name="sysModule.tempUrl" id="addForm_tempUrl" value=""/>
					        
					        <input type="hidden"  name="sysModule.cateNo" id="addForm_cateNo" value="customer"/>
					        <input type="hidden"  name="sysModule.cateName" id="addForm_cateName" value="定制模式"/>
							
						    <input type="hidden" id="addForm_fatherId" name="sysModule.fatherId" value="0" />
						    
						    <input type="hidden" id="addForm_num" name="sysModule.num"  placeholder="顶级系统 0,一级菜单1,二级菜单2" />
						    <input type="hidden" id="addForm_ifLast" name="sysModule.ifLast"  placeholder="是否最底层节点" />
							<input type="hidden" name="sysModule.sysName"  class="clean" value="" />


					        <div class="box-body" id="addForm_submitFormData">
					          <!-- Custom Tabs -->
					          <div class="nav-tabs-custom">
					            <div class="tab-content">
					              <div class="tab-pane active" id="addtab_1" >
					              
									  <div class="row">
										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" ><font class="text-red">*</font><label class="moduleLabel"></label>名称</label>
											  <div class="col-sm-8">
												  <input type="text" id="addForm_title" name="sysModule.title" class="form-control clean" maxLength="30" placeholder="填写说明：中文功能名称" />
											  </div>
										  </div>
										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" ><font class="text-red">*</font><label class="moduleLabel"></label>标识</label>
											  <div class="col-sm-8">
												  <input type="text" id="addForm_code" onblur="addMenuId(this,'addForm','addForm_menuId')" name="sysModule.code" class="form-control clean" maxLength="30" placeholder="必填，格式如 pro-list"/>
											  </div>
										  </div>
										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label"><font class="text-red">*</font>是否显示</label>
											  <div class="col-sm-8">
												  <select id="addForm_ifShow" name="sysModule.ifShow" class="form-control"
														  data-dict-code="dictItemList" data-dict-cate="yesOrNo" data-colmun=""
														  data-condition="" data-type-tag="select" data-def="T">
													  <option value="">--请选择--</option>
												  </select>
											  </div>
										  </div>
										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label"><font class="text-red">*</font>排序编号</label>
											  <div class="col-sm-8">
												  <input type="text" class="form-control clean" id="addForm_orderNo" maxlength="3" name="sysModule.orderNo"  placeholder="排序编号" />
											  </div>
										  </div>

										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" >是否自定义</label>
											  <div class="col-sm-8">
												  <div class="form-control-content" id="addForm_isCustom" name="sysModule.isCustom"
													   data-dict-code="dictItemList" data-dict-cate="yesOrNo" data-colmun=""
													   data-type-tag="radio" data-def="F">
												  </div>
											  </div>
										  </div>

										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" >权限控制</label>
											  <div class="col-sm-8">
												  <div class="input-group">
													  <input type="text" id="addForm_actEname" readonly="readonly" name="sysModule.actEname" class="form-control clean" maxLength="500"  placeholder="标识:如 /website" />
													  <div class="input-group-addon red">
														  <button type="button" class="btn btn-primary btn-xs" onclick="toOpenActChoice('addForm_actEname')"> <i class="fa fa-cog"></i> 选择权限</button>
													  </div>
												  </div>
											  </div>
										  </div>

										  <div class="form-group col-sm-12">
											  <label class="col-sm-2 control-label" >菜单图标</label>
											  <div class="col-sm-4">
												  <input type="text" name="sysModule.menuIcon" class="form-control clean" maxLength="20"  placeholder="非必填项，填写格式如 fa-cog" />
											  </div>
											  <div class="col-sm-6">
												  <span class="link-black f12" >
													  说明：不填写时默认图标为<i class="fa fa-cog"></i>；
													  也可以<a target="_blank" href="http://www.fontawesome.com.cn/faicons/">点此查看更多</a>图标进行选择，<br/>在填写时必须注意格式为 fa-* 这样的规范！
												  </span>
											  </div>
										  </div>

										  <div class="form-group col-sm-12 childShow hidden">
											  <label class="col-sm-2 control-label" >菜单/页面ID</label>
											  <div class="col-sm-10">
												  <input type="text" id="addForm_menuId" readonly="readonly" name="sysModule.menuId" class="form-control clean" maxLength="50"  placeholder="必填，格式如 pro-list" />
											  </div>
										  </div>
										  <div class="form-group col-sm-12 childShow">
											  <label class="col-sm-2 control-label" ><font class="text-red">*</font>页面所在目录</label>
											  <div class="col-sm-10">
												  <input type="text" id="addForm_pageRoot" name="sysModule.pageRoot" class="form-control clean" maxLength="50" required placeholder="必填，格式如 /plateform/admin/product/" />
											  </div>
										  </div>
										  <div class="form-group col-sm-12 childShow">
											  <label class="col-sm-2 control-label" ><font class="text-red">*</font>页面请求地址</label>
											  <div class="col-sm-10">
												  <input type="text"  name="sysModule.pageUrl" id="addForm_pageUrl" class="form-control clean" maxLength="100" required placeholder="必填，格式如 /plateform/admin/product/pro-list" />
											  </div>
										  </div>

										  <div class="form-group col-sm-12">
											  <label class="col-sm-2 control-label" >功能描述</label>
											  <div class="col-sm-10">
												  <textarea class="form-control clean" rows="3" data-name="sysModule.remark" id="addForm_remark" name="sysModule.remark"  maxLength="2000" placeholder="最多输入2000字"  data-type="textarea" ></textarea>
											  </div>
										  </div>
									  </div>

					              </div>					             
					              <!-- /.tab-pane -->
					            </div>
					            <!-- /.tab-content -->
					          </div>
					          <!-- nav-tabs-custom -->
					        </div>
			                <div class="box-footer">
				                <button type="button" class="btn btn-success pull-left" onclick="mytools.closeModal('my_modal_add');">取消</button>
				                <button type="button" class="btn btn-danger pull-right" onclick="add('addForm');">提 交</button>
				            </div>
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>     
    
<div class="modal fade" id="my_modal_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 900px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">信息修改</font> 
						</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" role="form" id="editForm" action="javascript:;">
							<input type="hidden" id="editForm_formToken" name="formToken" >
							<input type="hidden" name="pageName"  value="sysModule-list">
							<input type="hidden" name="formName"  value="editForm">
							<input type="hidden" id="w_moduleId" data-name="sysModule.moduleId" name="sysModule.w_moduleId"  value="">
							
							<input type="hidden" data-name="sysModule.tempName" name="sysModule.tempName" id="editForm_tempName" value=""/>
					        <input type="hidden" data-name="sysModule.tempUrl" name="sysModule.tempUrl" id="editForm_tempUrl" value=""/>
					        <input type="hidden" data-name="sysModule.cateNo" name="sysModule.cateNo" id="editForm_cateNo" value=""/>
					        <input type="hidden"  data-name="sysModule.cateName" name="sysModule.cateName" id="editForm_cateName" value=""/>
					        
						    <input type="hidden" id="editForm_num" name="sysModule.num" data-name="sysModule.num" placeholder="顶级系统 0,一级菜单1,二级菜单2" />
						    <input type="hidden" id="editForm_ifLast" name="sysModule.ifLast" data-name="sysModule.ifLast" placeholder="是否最底层节点" />
							<input type="hidden" id="editForm_menuId" name="sysModule.menuId" data-name="sysModule.menuId"/>
					        <div class="box-body" id="editForm_submitFormData">
					          <!-- Custom Tabs -->
					          <div class="nav-tabs-custom">
					            <div class="tab-content">
					              <div class="tab-pane active" id="editFormtab_1">

									  <div class="row">
										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" ><font class="text-red">*</font>菜单名称</label>
											  <div class="col-sm-8">
												  <input type="text" id="editForm_title" data-name="sysModule.title" name="sysModule.title" class="form-control clean" maxLength="50" />
											  </div>
										  </div>

										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" ><font class="text-red">*</font>菜单标识</label>
											  <div class="col-sm-8">
												  <input type="text" id="editForm_code" onblur="addMenuId(this,'editForm','editForm_menuId')" data-name="sysModule.code" name="sysModule.code" class="form-control clean" maxLength="50"/>
											  </div>
										  </div>

										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" ><font class="text-red">*</font>是否显示</label>
											  <div class="col-sm-8">
												  <select id="editForm_ifShow" name="sysModule.ifShow" data-name="sysModule.ifShow" class="form-control"
														  data-dict-code="dictItemList" data-dict-cate="yesOrNo" data-colmun=""
														  data-condition="" data-type-tag="select" data-def="">
													  <option value="">--请选择--</option>
												  </select>
											  </div>
										  </div>

										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" ><font class="text-red">*</font>排序编号</label>
											  <div class="col-sm-8">
												  <input type="text" class="form-control clean" id="editForm_orderNo" name="sysModule.orderNo" data-name="sysModule.orderNo" placeholder="排序编号" />
											  </div>
										  </div>


										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 control-label" >是否自定义</label>
											  <div class="col-sm-8">
												  <div class="form-control-content" id="editForm_isCustom" name="sysModule.isCustom"
													   data-dict-code="dictItemList" data-dict-cate="yesOrNo" data-colmun=""
													   data-type-tag="radio" data-def="">
												  </div>
											  </div>
										  </div>

										  <div class="form-group col-sm-6">
											  <label class="col-sm-4 col-sm-6 control-label" >权限控制</label>
											  <div class="col-sm-8">
												  <div class="input-group">
													  <input type="text" id="editForm_actEname" readonly="readonly" data-name="sysModule.actEname" name="sysModule.s_actEname" class="form-control clean" maxLength="100" required placeholder="填写说明：权限标识，比如/website" />
													  <div class="input-group-addon red">
														  <button type="button" class="btn btn-primary btn-xs" onclick="toOpenActChoice('editForm_actEname')"> <i class="fa fa-cog"></i> 选择权限</button>
													  </div>
												  </div>
											  </div>
										  </div>

										  <div class="form-group col-sm-12">
											  <label class="col-sm-2 control-label" >菜单图标</label>
											  <div class="col-sm-4">
												  <input type="text" name="sysModule.menuIcon" data-name="sysModule.menuIcon" class="form-control clean" maxLength="20"  placeholder="非必填项，填写格式如 fa-cog" />
											  </div>
											  <div class="col-sm-6">
												  <span class="link-black f12" >
													  说明：不填写时默认图标为<i class="fa fa-cog"></i>；
													  也可以<a target="_blank" href="http://www.fontawesome.com.cn/faicons/">点此查看更多</a>图标进行选择，<br/>在填写时必须注意格式为 fa-* 这样的规范！
												  </span>
											  </div>
										  </div>

										  <div class="form-group col-sm-12 childShow">
											  <label class="col-sm-2 control-label" ><font class="text-red">*</font>页面所在目录</label>
											  <div class="col-sm-10">
												  <input type="text" data-name="sysModule.pageRoot" name="sysModule.pageRoot"  class="form-control clean" id="editForm_pageRoot" value="" placeholder="填写说明：如/plateform/admin/product/"/>
											  </div>
										  </div>

										  <div class="form-group col-sm-12 childShow">
											  <label class="col-sm-2 control-label" ><font class="text-red">*</font>页面请求地址</label>
											  <div class="col-sm-10">
												  <input type="text" data-name="sysModule.pageUrl" name="sysModule.pageUrl"  class="form-control clean" id="editForm_pageUrl" value=""/>
											  </div>
										  </div>

										  <div class="form-group col-sm-12">
											  <label class="col-sm-2 control-label" >功能描述</label>
											  <div class="col-sm-10">
												  <textarea class="form-control" rows="3" data-name="sysModule.remark" id="editForm_remark" name="sysModule.remark"  maxLength="2000" placeholder="最多输入2000字"  data-type="textarea" ></textarea>
											  </div>
										  </div>
									  </div>

					              </div>					             
					              <!-- /.tab-pane -->
					            </div>
					            <!-- /.tab-content -->
					          </div>
					          <!-- nav-tabs-custom -->
					        </div>
			                <div class="box-footer">
				                <button type="button" class="btn btn-success pull-left" onclick="cannel('edit');">取消</button>
				                <button type="button" class="btn btn-danger pull-right" onclick="edit('editForm');">提 交</button>
				            </div>
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>      
    
 <div win-title="查看窗口" class="modal fade" id="my_modal_view" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">查看详情</font> 
						</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" role="form" id="viewForm" action="javascript:;">
						   
					        <div class="box-body">
					          <!-- Custom Tabs -->
					          <div class="nav-tabs-custom">
					            <div class="tab-content">
					              <div class="tab-pane active" id="viewtab_1">
					              
					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >菜单名称</label>
					                  <div class="col-sm-8 form-control-static">
										<span data-name="sysModule.title"></span>
					                  </div>
					                </div>
					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >菜单标识</label>
					                  <div class="col-sm-8 form-control-static">
					                  	<span data-name="sysModule.code"></span>
					                  </div>
					                </div>
					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >功能描述</label>
					                  <div class="col-sm-8 form-control-static">
										<span data-name="sysModule.remark"></span>
					                  </div>
					                </div>

					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >最底层节点</label>
					                  <div class="col-sm-8 form-control-static">
										<span data-name="sysModule.ifLast" data-dict-url="doCode=dictItemList&cateEname=yesOrNo"></span>
					                  </div>
					                </div>
									
									
									<!--  
					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >选用模板</label>
					                  <div class="col-sm-8">
										<span data-name="sysModule.tempName"></span> | <span data-name="sysModule.tempId"></span>
					                  </div>
					                </div>
					                -->
					                
					                
					                 <div class="form-group">
						                  <label class="col-sm-3 control-label" >菜单/页面ID</label>
						                  <div class="col-sm-8 form-control-static">
						                  	<span data-name="sysModule.menuId"></span>
						                  </div>
							        </div>

					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >节点编号</label>
					                  <div class="col-sm-8 form-control-static">
										<span data-name="sysModule.num"></span>
					                  </div>
					                </div>
					                
					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >所属工程</label>
					                  <div class="col-sm-8 form-control-static">
									  	<span id="viewForm_sysName" name="sysModule.sysName" data-name="sysModule.sysName"></span>
					                  </div>
					                </div>
					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >页面所在目录</label>
					                  <div class="col-sm-8 form-control-static">
					                  	<span data-name="sysModule.pageRoot"></span>
					                  </div>
					                </div>
					                <div class="form-group">
					                  <label class="col-sm-3 control-label" >页面地址</label>
					                  <div class="col-sm-8 form-control-static">
					        				<span data-name="sysModule.pageUrl"></span>
					                  </div>
					                </div>

									  <!--
								  <div class="form-group">
									  <label class="col-sm-3 control-label" >权限标识</label>
									  <div class="col-sm-8 form-control-static">
										  <span data-name="sysModule.actEname"></span>
									  </div>
								  </div>-->
					                
					              </div>					             
					              <!-- /.tab-pane -->
					            </div>
					            <!-- /.tab-content -->
					          </div>
					          <!-- nav-tabs-custom -->
					        </div>
			                <div class="box-footer">
				                <button type="button" class="btn btn-success pull-right" onclick="cannel('view');">关闭</button>
				            </div>
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>

<div win-title="系统选型窗口" class="modal fade" id="my_module_temp" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 700px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">操作提示</font> 
						</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" role="form" id="createModuleForm" action="javascript:;">
							<input type="hidden" id="editForm_check_formToken" name="formToken" >
							<input type="hidden" name="moduleId" id="create_moduleId" value="">
							<input type="hidden" name="databaseType" value="${database_type}"/>
					        <div class="box-body" id="editForm_check_submitFormData">
					          <!-- Custom Tabs -->
					          <div class="nav-tabs-custom">
					            <div class="tab-content">
					              <div class="tab-pane active" id="edittab_1">
								  <div class="form-group">
									  <div class="col-sm-12 form-control-static">
										  该生成系统菜单操作，将会替换原有菜单内容，你确认要继续吗？
									  </div>
								  </div>
					                <div class="form-group hidden">
					                  <label class="col-sm-3 control-label" >集成类型 </label>
					                  <div class="col-sm-8">
					                  		  <select name="moduleType" class="form-control">
												  <option value="1">load-集成</option>
												  <option value="2" selected="selected">pjax-独立</option>
											  </select>
					                  </div>
					                </div>
					              </div>					             
					              <!-- /.tab-pane -->
					            </div>
					            <!-- /.tab-content -->
					          </div>
					          <!-- nav-tabs-custom -->
					        </div>
			                <div class="box-footer">
				                <button type="button" class="btn btn-danger pull-right" onclick="createMenu();">确认生成</button>
				            </div>
						</form>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>
<!-- 以下是template列表模板的模块区域 -->
<script type="text/template" id="dataList-template">
	<? var datastep = false?>
		<? for ( var i = 0; i < rows.length; i++) {?>
		<tr <?if(rows[i].num=='1' && !datastep){?>data-step="1" data-intro="选中任意[1级别]的数据记录"<?datastep=true;}?> id=<?=rows[i].moduleId?> treeLevel=<?=rows[i].num?> fatherId=<?=rows[i].fatherId?> class="drag-box">
			<th style="display:none;"><?=rows[i].moduleId?></th>
			<th style="display:none;"><?=rows[i].sysName?></th>
			<th style="display:none;"><?=rows[i].ifLast?></th>
			<th style="display:none;"><?=rows[i].num?></th>
			<td>
						<?if(rows[i].ifLast=="F"){?>
							<i class="fa  fa-plus fx16" style="cursor:pointer" onclick="getChildTableData('<?=rows[i].moduleId?>','<?=rows[i].num?>',this);"></i>&nbsp;<?=rows[i].title?>
						<?} else{?>
							<?if(!strUtil.isNull(rows[i].num) && rows[i].num=='2'){?>
								<?=rows[i].title?>
							<?}else{?>
								<i class="fa fa-minus fx16" ></i>&nbsp;<?=rows[i].title?>
							<?}?>
						<?}?>
			</td>
            <td title="<?=rows[i].title?>">
			<?if(!strUtil.isNull(rows[i].num) && rows[i].num=='2'){?>
				<a href="${ctx}/sendPage<?=rows[i].pageUrl?>" target="_bank" title="点击预览"><?=strUtil.doNull(rows[i].code,'')?></a>
			<?}else{?>
				<?=strUtil.doNull(rows[i].code,'')?>
			<?}?>
			</td>
            <td>
				<?if(strUtil.doNull(rows[i].num,'0')=="0"){?>
					-
				<?}else{?>
					<?=strUtil.doNull(rows[i].orderNo,'')?>/
					<?if(rows[i].num=='1'){?><i class="fa <?=strUtil.doNull(rows[i].menuIcon,'fa-cog')?>"></i><?}?>
					<?if(rows[i].num=='2'){?><i class="fa <?=strUtil.doNull(rows[i].menuIcon,'fa-circle-o')?>"></i><?}?>
				<?}?>
			</td>
            <td><?=strUtil.doNull(rows[i].num,'')?>级/
					<?if(strUtil.doNull(rows[i].ifShow,'-')=="T"){?>
						是
					<?}else{?>
						否
					<?}?>
			</td>
            <td>
					<button type="button" class="btn btn-success btn-xs" onclick="toLoad('<?=rows[i].moduleId?>','view')">查看</button>  
					<button type="button" class="btn btn-warning btn-xs" onclick="toLoad('<?=rows[i].moduleId?>','edit');">修改</button>  
					<button type="button" class="btn btn-danger btn-xs" onclick="toDele('<?=rows[i].moduleId?>');">删除</button>   
				<?if(rows[i].num=="0"){?>&nbsp;
					<button data-step="3" data-intro="点此按钮生成本系统菜单" type="button" class="btn btn-primary btn-xs" onclick="viewCreateModule('<?=rows[i].moduleId?>')">生成系统菜单</button>&nbsp;
					<button data-step="4" data-intro="点此按钮预览本系统工程，进行功能预览及测试" type="button" class="btn btn-info btn-xs" onclick="viewSysAdmin('<?=rows[i].sysName?>')">
						<i class="fa fa-search-plus"></i> 访问系统
					</button>
				<?}?>
				<?if(rows[i].ifLast=="T" && rows[i].isCustom=="F"){?>

					<?if(rows[i].ifUsed=="T"){?>
						<button type="button" id="tsBtn_<?=rows[i].moduleId?>" class="btn btn-default btn-sm" onclick="msgShow(this,'scBtn_<?=rows[i].moduleId?>');" >重新生成页面</button> 
<!-- <button type="button" class="btn btn-primary btn-xs" onclick="toEditPage(this,'scBtn_<?=rows[i].moduleId?>','<?=rows[i].pageRoot?>','<?=rows[i].menuId?>');" ><i class="fa fa-edit"></i> 表单设计器</button>-->
						<button type="button" class="btn btn-info btn-xs" onclick="toEditPage2(this,'scBtn_<?=rows[i].moduleId?>','<?=rows[i].pageRoot?>','<?=rows[i].menuId?>');" ><i class="fa fa-edit"></i> 表单设计器</button>  
						<button type="button" id="scBtn_<?=rows[i].moduleId?>" style="display:none;" class="btn btn-info btn-sm" onclick="toCreateInstance('<?=rows[i].tempId?>','<?=strUtil.doNull(rows[i].sysName,"")?>','<?=strUtil.doNull(rows[i].title,"")?>','<?=strUtil.doNull(rows[i].menuId,"")?>','<?=strUtil.doNull(rows[i].moduleId,"")?>','<?=rows[i].pageRoot?>');">创建生成策略</button>

					<?}else{?>&nbsp;
						<button data-step="1" data-intro="点此按钮创建功能页面，配置生成策略。" type="button" id="scBtn_<?=rows[i].moduleId?>" class="btn btn-info btn-sm" onclick="toCreateInstance('<?=rows[i].tempId?>','<?=strUtil.doNull(rows[i].sysName,"")?>','<?=strUtil.doNull(rows[i].title,"")?>','<?=strUtil.doNull(rows[i].menuId,"")?>','<?=strUtil.doNull(rows[i].moduleId,"")?>','<?=rows[i].pageRoot?>');">创建生成策略</button>&nbsp;
						<button data-step="2" data-intro="点此按钮进行表单设计制作。" type="button" class="btn btn-info btn-xs disabled"><i class="fa fa-edit"></i> 表单设计器</button>
					<?}?>
				<?}?>

			</td>
		</tr>
   <?}?>  		
</script>




<!-- 以下是js模块区域 -->
<script>
var clickMenu = "sysModule-list";
var id,sysName,ifLast,treeLevel,myPage,dataListId,searchFormId,isShowLog,tableSort,tableId;
myPage = 10;
dataListId = "dataList";
searchFormId = "searchForm";
tableSort = "sysModule";
tableId = "moduleId";
isShowLog = true;
var checkModuleCode="",checkModuleTitle="";
var defSysEname = strUtil.doNull(strUtil.getLocalStorage("sysEname"), "");
/**
 * 初始化数据字典，id传入#id 返回值Map用法：dictListMap["userType"][rows[i].userType]
 */
var dictListMap = DictUtil.initDictAndDymic();

$(function () {
	//1、加载分页列表数据
	$("#searchForm_sysName").val(defSysEname);
	getTableData();
	//2、控制是否启用token
	//setToken();
	//请在下面补充其他初始化方法（如数据字典、页面加载数据等）
	//3、初始化数据字典
	//DictUtil.getCommonDictData("select","#addForm_ifShow","sysModule.ifShow","doCode=dictItemList&cateEname=yesOrNo","{value:'itemValue',text:'itemText'}","T");
	//DictUtil.getCommonDictData("radio","#addForm_isCustom","sysModule.isCustom","doCode=dictItemList&cateEname=yesOrNo","","");
	//DictUtil.getCommonDictData("select","#addForm_tempId","sysModule.tempId","doCode=dymicSql&modelTypes=s_sysTemplate&sysTemplate.wl_templateUrl=coding/","{value:'templateId',text:'templateDesc',other:'templateUrl,codeUrl,pageName'} ","");
	//loadView.....("","#viewForm_sysName","uctSys.w_sysEname","doCode=dymicSql&modelTypes=s_uctSys","{value:'sysEname',text:'sysCname'}","");



 });
var dateObject = $('.datepicker').datepicker( {
	language : 'zh-CN',
	//inline: true,
	todayBtn : "linked",
	format : "yyyy-mm-dd",
	autoclose: true
});
//读取（查询、编辑）数据
function toLoad(id,type){
	var paramLoadData = {"sysModule.w_moduleId":id,"pageName":"sysModule-list","formName":"searchForm"};
	loadObj(type,paramLoadData);
}
function toDele(id){
    var index_load = layer.load(1, {shade: false});
    $.getJSON(common_list_url, {"pageName":"sysModule-list","formName":"searchForm","sysModule.w_fatherId":id}, function(myData){
        console.log(myData);
        if(myData.flag=="T"){
            layer.close(index_load);
            if(myData.total>0){
                layer.alert('当前节点存在子节点，不能删除！', {icon: 2});
                return;
            }
            var index_submit = layer.confirm('您确定要删除该节点吗？删除之后不可恢复，请谨慎操作！', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
			, function(){
				layer.close(index_submit);
				var paramLoadData = {"pageName":"sysModule-list","formName":"delForm","sysModule.w_moduleId":id};
				//var paramLoadData = {"modelTypes":"u_sysModule","sysModule.delStatus":"T","sysModule.w_moduleId":id};
				doDele(paramLoadData);
			});
		}
    });
}
//反显数据
function showData(type,myData){
	if("view"==type){
		FormUtil.loadView("sysModule", myData);
		$("#my_modal_view").modal("show");
	}else if("edit"==type){
		//修改弹框时，初始化数据字典
		mytools.cleanData('#editForm_submitFormData');
		//DictUtil.getCommonDictData("select","#editForm_sysName","sysModule.sysEname","doCode=dymicSql&modelTypes=s_uctSys&uctSys.w_sysEname="+defSysEname,"{value:'sysEname',text:'sysCname'}",myData.sysName);
		//DictUtil.getCommonDictData("select","#editForm_ifShow","sysModule.ifShow","doCode=dictItemList&cateEname=yesOrNo","{value:'itemValue',text:'itemText'}",myData.ifShow);
		//DictUtil.getCommonDictData("radio","#editForm_isCustom","sysModule.isCustom","doCode=dictItemList&cateEname=yesOrNo","",myData.isCustom);
		//DictUtil.getCommonDictData("select","#editForm_tempId","sysModule.tempId","doCode=dymicSql&modelTypes=s_sysTemplate&sysTemplate.wl_templateUrl=coding/","{value:'templateId',text:'templateDesc',other:'templateUrl,codeUrl,pageName'} ",myData.tempId);
		FormUtil.loadView("sysModule", myData);
		//FormUtil.fillData("#editForm", myData,"id");
		$("#w_"+tableId).val(myData.moduleId);
        setValidate("#editForm");//定义add表单验证属性
        mytools.cleanValidate("#editForm");//清空上次校验规则提示
		$("#my_modal_edit").modal("show");
		$("input:radio[name='sysModule.ifLast']").click(function(){
			 var selectVal = $(this).val();
		});
		
	}
}

$(function () {
	$('#'+dataListId+' tbody').on('click','tr', function (e) {
	     if ( $(this).hasClass('selected') ) {
	            //$(this).removeClass('selected');
	        }
	        else {
	            $('tr.selected').removeClass('selected');
	            $(this).addClass('selected');
	        }
	     id = $('tr.selected th').eq(0).html();
	     sysName = $('tr.selected th').eq(1).html();
	     ifLast = $('tr.selected th').eq(2).html();
	     treeLevel = $('tr.selected th').eq(3).html();
        checkModuleTitle = $('tr.selected td').eq(1).attr("title");
        checkModuleCode = $('tr.selected td').eq(1).html();
	   //  console.log($('tr.selected td').eq(1).html())
	} );
	
	
  });
//加载列表数据
function getTableData(){
	//closeDrag(dataListId+"-body");
    var index_load = layer.load(1, {shade: false});
    $("#btn-init-sysmodule").remove();
    $("#"+dataListId+"-body").html("");
    $("#"+searchFormId).find("input[name='sysModule.w_sysName']").val(defSysEname);
	$.ajax({
		   type:'get',
		   url:common_list_url,
		   data:$("#"+searchFormId).serialize()+getCurrentPage(common_list_url+"?"+$("#"+searchFormId).serialize(),myPage),
		   dataType:'json',
		   async:false,
		   success: function(myData){
		 		// console.log(myData);
			   if(myData.flag=="T"){
				   if(myData.total>0){
                       var data = baidu.template(dataListId+"-template",eval(myData));
                       $("#"+dataListId+"-body").html(data);
                       var option= {
                           ele:$("#"+dataListId+"-page")[0],
                           total:myData.total,
                           fn:getTableData,
                           url:common_list_url+"?"+$("#"+searchFormId).serialize()
                       }
                       generatePages(option);

                       //openDrag(dataListId+"-body");

//                       setTimeout( function(){
//                           var firstTdObj = $('#'+dataListId+' tbody').find("tr .fa-plus").eq(0);
                           var firstTdObj = $('#'+dataListId+' tbody').find("tr[fatherid='0'] > td > i");// .fa-plus").eq(0);
                           firstTdObj.click();
                           layer.close(index_load);

//                       },500);


				   }else{
				       //没数据，就补充一个：初始化按钮
                       layer.close(index_load);
                       if(!strUtil.isNull(defSysEname) && ($("#btn-init-sysmodule").length==0) ){
                           var btnInitHtml ="<button id='btn-init-sysmodule' class='btn btn-warning' type='button' onclick=\"addInitSysModule();\"><i class='fa fa-code'></i> 初始化数据</button>&nbsp;";
                           $("#btn-add-child").before(btnInitHtml);
					   }
				   }

			   }
		   }

		});	
  }

//初始化系统模块
function getModuleData(title,code,fatherId,num,orderNo){
    var paramData = {};
    paramData["pageName"]="sysModule-list";
    paramData["formName"]="addForm";
    paramData["sysModule.fatherId"]=fatherId;
    paramData["sysModule.delStatus"]="F";
    paramData["sysModule.cateNo"]=code;
    paramData["sysModule.cateName"]=title;
    paramData["sysModule.num"]=num;
    paramData["sysModule.ifLast"]="F";
    paramData["sysModule.title"]=title;//名称
    paramData["sysModule.code"]=code;//标识
    paramData["sysModule.ifShow"]="T";//是否显示
    paramData["sysModule.orderNo"]=orderNo;//排序号
    paramData["sysModule.sysName"]=defSysEname;//所属工程
    return paramData;
}
//初始化系统模块
function addInitSysModule(){
    var msg_load = layer.msg("正在初始化系统菜单数据，请耐心等待...");

	$.getJSON(common_info_url,{"pageName":"uct-sys","formName":"searchForm","uctSys.w_sysEname":defSysEname},function(myData){
		// console.log(myData);
        var paramData = getModuleData(myData.sysCname,defSysEname,"0","0","0");
        $.ajax({
            type:"post",url:common_submit_url,data: paramData,dataType:"json",async:false,
            success: function(myData){
                console.log(myData);
                if(myData.flag=="T" && !strUtil.isNull(myData.ids)){
                    var modulefatherId = myData.ids.sysModule_moduleId;
                    var paramDataChild_1 = getModuleData("测试菜单一","test-first",modulefatherId,"1","1");
                    var paramDataChild_2 = getModuleData("测试菜单二","test-second",modulefatherId,"1","2");
                    msg_load = layer.msg("测试菜单一初始化中...");
                    $.ajax({
                        type:"post",url:common_submit_url,data: paramDataChild_1,dataType:"json",async:false,
                        success: function(myData){
                            console.log(myData);
                            if(myData.flag!="T"){
                                msg_load = layer.msg("测试菜单一初始化失败："+myData.msg);
                            }
                           // refresh();
                        }
                    });
                    msg_load = layer.msg("测试菜单二初始化中...");
                    $.ajax({
                        type:"post",url:common_submit_url,data: paramDataChild_2,dataType:"json",async:false,
                        success: function(myData){
                            // console.log(myData);
                            if(myData.flag!="T"){
                                msg_load = layer.msg("测试菜单二初始化失败："+myData.msg);
                            }
                            refresh();
                        }
                    });
                    layer.close(msg_load);
                }else{
                    layer.alert("初始化菜单数据，操作失败");
                }
            }
        });
	});

}

  //设置模态框隐藏事件
$( '#my_modal_add' ).on( 'show.bs.modal' ,function(e){  
	setToken();
}); 
//清空数据
function cleanData(id){
	$('#'+id).find(".clean").val("");//按照样式清空；
}
//打开添加页面
function toAdd(type){
	
	cleanData('addForm_submitFormData');//清空模态窗口内数据
	$(".childShow").hide();
	$("#w_"+tableId).val("");
    $(".datepicker").val("");

	var formId = "#addForm";
    $(formId).find("input[name='sysModule.sysName']").val(defSysEname);
    setValidate(formId);//定义add表单验证属性
    mytools.cleanValidate(formId);//清空上次校验规则提示

	if(type=="parent"){
		$("#addForm_num").val("0");
		$("#addForm_ifLast").val("F");
		$(".moduleLabel").html("模块");
		$("#addForm_fatherId").val("0");
		$('#my_modal_add').modal('show');
	}else{
		
		$(".moduleLabel").html("菜单");
		if(!strUtil.isNull(checkModuleCode)){
		    $("#span-module-add-title").text(" 上一级："+checkModuleTitle+" ["+checkModuleCode+"]");
		}
		if(id!=null　&& id!=""){
            getNextOrderNo(id);
			if(treeLevel=="0"){
				$("#addForm_num").val("1");
				$("#addForm_ifLast").val("F");
				$(".childShow").hide();
                $("#span-module-no-text").text("一级菜单");
			}
			if(treeLevel=="1"){
				$("#addForm_num").val("2");
				$("#addForm_ifLast").val("T");
				$(".childShow").show();
                $("#span-module-no-text").text("二级菜单");
			}
			if(ifLast=="T"){
				layer.alert("该功能已经是最底层节点，不允许添加子菜单！");
			}else{
				$("#addForm_fatherId").val(id);
				$("#addForm_sysName").val(sysName);
				$("#addForm_sysName").attr("readOnly",true);
				$('#my_modal_add').modal('show');
			}
		}else{
			layer.alert("请选中一条数据！");
			return;
		}
	}
	
}

//获取对象值
function loadObj(type,paramData){
	$.ajax({
	    type:'get',
	   	url:common_info_url+"?doCode=dymicSql",
	    data: paramData,
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	showData(type,myData);
	    	var ifLast = myData.ifLast;
	    	var isCustom = myData.isCustom;
	    	if(ifLast=="T"){
				$(".childShow").show();
	    	}else{
				$(".childShow").hide();
	    	}
	    	
	  	}
	});	
}

//删除信息（逻辑删除）
function doDele(paramData){
	$.ajax({
	    type:"post",
	    url:common_submit_url,
	    data: paramData,
	    dataType:"json",
	    success: function(myData){
	    	var result = myData.flag;
	    	if(result=="T"){
	    		layer.alert("删除操作成功");
	    		refresh();
	    	}
	  	}
	});	
}

/**
 * 新增表单数据提交
 * @param formId
 */
function add(formId){

    var validate = $('#'+formId).data('bootstrapValidator').validate();
    if (!validate.isValid()) { //如果校验不通过就返回
        return;
    }
	$("#addForm_cateName").val($("#addForm_title").val());
	$("#addForm_cateNo").val($("#addForm_code").val());
	var index_submit = layer.confirm('您确定要提交信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		$.ajax({
		    type:"post",
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    dataType:"json",
		    success: function(myData){
		    	//console.log(myData);
		    	if(myData.flag=="T"){
		    		layer.alert("数据保存成功");
		    		$("#my_modal_add").modal("hide");
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		    	refresh();
		  	}
		});	
	});
}

/**
 * 修改表单数据提交
 * @param formId
 */
function edit(formId){
    var validate = $('#'+formId).data('bootstrapValidator').validate();
    if (!validate.isValid()) { //如果校验不通过就返回
        return;
    }
	$("#editForm_cateName").val($("#editForm_title").val());
	$("#editForm_cateNo").val($("#editForm_code").val());
	var index_submit = layer.confirm('您确定要提交信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		$.ajax({
		    type:"post",
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    dataType:"json",
		    success: function(myData){
		    	//console.log(myData);
		    	if(myData.flag=="T"){
		    		layer.alert("数据保存成功");
		    		$("#my_modal_edit").modal("hide");
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		    	refresh();
		  	}
		});	
	});
}

//关闭win
function cannel(type){
	if(strUtil.isNull(type)){
		$('#my_modal_add').modal('hide');
	}else{
		$('#my_modal_'+type).modal('hide');
	}
}

function refresh(){
	getTableData();
}


function setToken(){
	$.ajax({
	    type:'get',
	    url:ctx+'/sendPage/token?token=true',
	    dataType:'text',
	    success: function(myData){
	    	//console.log(myData);
			$('#addForm_formToken').val(myData);
			$('#editForm_formToken').val(myData);
	  	}
	});	
}



/****  以下是自定义新增方法  ****/
 
 function getChildTableData(id,treeLevel,obj){
	//closeDrag(dataListId+"-body");
    var index_load = layer.load(1, {shade: false});
	var databaseType = "${database_type}";
	var orderBy = 'sysModule.if_show desc,sysModule.num asc,sysModule.order_no asc';
	if(databaseType=="mysql"){
        orderBy =  'sysModule.if_show desc,sysModule.num asc,sysModule.order_no+0 asc';
	}
	$.ajax({
		   type:'get',
		   url:common_list_url,
		   data:{'sysModule.w_fatherId':id,'doCode':'dymicSql','pageName':'sysModule-list','formName':'searchForm','orderBy':orderBy},
		   dataType:'json',
		   success: function(myData){
			var data = baidu.template(dataListId+"-template",eval(myData));  
			if($(obj).hasClass("fa-minus")){
				 $("[treeLevel='"+treeLevel+"']").each(function(){
					 $(this).addClass("drag-box");
			    	});
				$(obj).attr("class","fa fa-plus  fx16");
				delChiled(id);
			}else{
				 $("[treeLevel='"+treeLevel+"']").each(function(){
					 $(this).removeClass("drag-box");
			    	});
				$(obj).attr("class","fa fa-minus fx16");
				$("#"+id).after(data);
				 $("[fatherid='"+id+"']").each(function(i){
					var thisObj = $(this);
					var pd = "10px 20px 10px ";
					var num = pd+(parseInt(treeLevel)+1)*20+"px";
					$(thisObj).find("td").eq(0).css("padding",num);
				 });
			 }
			//openDrag(dataListId+"-body");
               layer.close(index_load);


               var _cookie_intro_flag= $.cookie('_iussoft_intro_project_module');
               if(strUtil.isNull(_cookie_intro_flag)){//第一次加载，就展示第一个一级菜单的最底层二级功能
//                   setTimeout( function(){
//                       var secondTdObj = $('#'+dataListId+' tbody').find("tr[treelevel='1']").eq(0).find(".fa-plus").eq(0);
//                       secondTdObj.click();
//                   },700);
               }
               if(treeLevel=='1'){//上面第一次递归调用后，判别出查二级功能时，给你提示
                   initGuideIntroJs();
               }

		   }
		});	
  } 
  
 function delChiled(id){
	  $("[fatherid='"+id+"']").each(function(i){
			 var thisObj = $(this);
			 $(thisObj).remove();
			 var id = thisObj.attr("id");
			 delChiled(id);
		 });
 }
 
 function changeSelectTo(tempId,tempNameId,tempUrlId,pageUrlId){
		var tempName=$("#"+tempId).find("option:selected").text();
		var tempUrl=$("#"+tempId).find("option:selected").attr("template-url");
		var codeUrl=$("#"+tempId).find("option:selected").attr("code-url");
		var pageName=$("#"+tempId).find("option:selected").attr("page-name");
		$("#"+tempNameId).val(tempName);
		$("#"+tempUrlId).val(tempUrl);
		$("#"+pageUrlId).val(codeUrl+"/"+pageName);
	}
 
 function viewCreateModule(moduleId){
	 //createModuleForm
	 $('#my_module_temp').modal('show');
	 $("#create_moduleId").val(moduleId);
 }
function viewSysAdmin(sysName){
    var sysLocalUrl  = ctx+"/sendPage/"+sysName+"/admin/index";
    window.open(sysLocalUrl);
}
 function createMenu(moduleId){
	 //var this_url ="${ctx}/common/coding/buildMenu";
     var index_load = layer.load(1, {shade: false});
	 $('#my_module_temp').modal('hide');
	 var this_url="${ctx}/common/coding/buildCateMenu";
	  $.ajax({type:'post',url:this_url,data:$("#createModuleForm").serialize(),cache: false,async:false,dataType:'json',
		   success: function(myData){ layer.close(index_load); layer.alert(myData.msg); }
	  });
 }

 function toCreateInstance(tempId,sysName,title,menuId,moduleId,pageRoot){
		var url ="${page_admin}/project/sysModule-page-instance?templateId="+tempId+"&sysEname="+sysName+"&projectName="+sysName+"&title="+title+"&menuId="+menuId+"&moduleId="+moduleId+"&pageRoot="+pageRoot;
		mytools.pjax(url);
		//window.location.href=url;
 }

 function msgShow(ob,scBtnId){
		var index_submit = layer.confirm('该功能已经生成相应页面，您确定要再次生成新的页面替换之前的吗？本次操作可能会将之前手动修改的内容覆盖掉，请谨慎操作！', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
		, function(){
			layer.close(index_submit);
			$(ob).hide();
			$("#"+scBtnId).show();
		});
	}
 
//打开文件 编辑窗口
function toEditPage(ob,moduleId,pageRoot,menuId){
	if(strUtil.isNull(pageRoot) || strUtil.isNull(menuId) ){
		layer.alert("页面ID和所在目录不能为空，请先补充！");
		return;
	}
	$.ajaxSetup ({cache: false});
	var file_url = ctx+"/sendPage/plateform/admin/module/page-edit?pageRoot="+pageRoot+"&fileName="+menuId+"&f="+new Date().getTime();
	layer.open({
	      type: 2,
	      title:"表单设计器["+menuId+"]",
	      shadeClose: true,
	      shade: false,
	      maxmin: true, //开启最大化最小化按钮
	      area: ['99%', '99%'],
	      content: file_url
	});
}
function toEditPage2(ob,moduleId,pageRoot,menuId){
	if(strUtil.isNull(pageRoot) || strUtil.isNull(menuId) ){
		layer.alert("页面ID和所在目录不能为空，请先补充！");
		return;
	}
	$.ajaxSetup ({cache: false});
	var file_url = ctx+"/sendPage/plateform/admin/module/page-edit-2?pageRoot="+pageRoot+"&fileName="+menuId+"&sysEname="+defSysEname+"&f="+new Date().getTime();
	layer.open({
	      type: 2,
	      title:"表单设计器["+menuId+"]",
	      shadeClose: true,
	      shade: false,
	      maxmin: true, //开启最大化最小化按钮
	      area: ['99%', '99%'],
	      content: file_url
	});
}
//打开权限选择
var openActWin=null;
var openActWinPreObjId = null;
function toOpenActChoice(objId) {
    openActWinPreObjId=objId;
    var file_url = ctx+"/sendPage/plateform/admin/project/user-act-choice?f="+new Date().getTime();
    openActWin=layer.open({
        type: 2,
        title:"权限选择",
        shadeClose: true,
        shade: false,
        maxmin: true, //开启最大化最小化按钮
        area: ['65%', '70%'],
        content: file_url
    });
}
function preActObjCallBack(actObj) {
    console.log("actObj",actObj);
    layer.close(openActWin);
    $("#"+openActWinPreObjId).val(actObj.fullEname);


}
function openDrag(id){
	
	$("#openDrag").attr("disabled","disabled");
	$("#closeDrag").removeAttr("disabled");
	   $("#"+id).dragsort({
	        dragSelector : ".drag-box",  //可以不用设置，他会根据$("#tableid")的类型来决定是tr还是li
	        dragEnd : function(){
	            //console.log($(this));  //拖动完成的回调函数，$(this)当前拖动对象
	            
	            var num=10;
	        	var paramData="?pageName=sysModule-list&formName=editBathForm&ifBatch=T&sysModule.splitAttr=orderNo";
	            $("#"+id).find("tr").each(function(){
	            	$(this).attr("order-no",++num)
	            	//调用ius的批量修改方法ub_sysModule
	            	paramData+="&sysModule.w_moduleId="+$(this).attr("id")+"&sysModule.orderNo="+$(this).attr("order-no");
	            });
	            
	        	$.ajax({
				    type:"post",
				    url:common_submit_url+paramData,
				    dataType:"json",
				    success: function(myData){
				     	layer.alert(myData.msg, {icon: 1,closeBtn: 0,offset: "220px"});
				  	}
				});	
	            
	            
	        },
	        scrollSpeed:0,  //默认为5，数值越大拖动的速度越快，为0则拖动时页面不会滚动
	    });
}

function closeDrag(id){
	$("#closeDrag").attr("disabled","disabled");
	$("#openDrag").removeAttr("disabled");
	$("#"+id).dragsort("destroy");
}

//输入完菜单标识后，补充其他值
function addMenuId(obj,formId,inputMenuId){
    var codeVal = $(obj).val();
    if(!strUtil.isNull(codeVal)){
        $("#"+inputMenuId).val(codeVal);
        var dirRootName = codeVal.split("-")[0];
        var pageRootVal = "/"+defSysEname+"/admin/"+dirRootName+"/";
		$("#"+formId).find("input[name='sysModule.pageRoot']").val(pageRootVal);
		$("#"+formId).find("input[name='sysModule.pageUrl']").val(pageRootVal+codeVal);
	}
}

//得到下一个排序号码
function getNextOrderNo(fatherId){
    $.ajax({
        type:'get',
        url:common_list_url,
        data:{'sysModule.w_fatherId':fatherId,'pageName':'sysModule-list','formName':'searchForm'},
        dataType:'json',
        success: function(myData){
            //alert(myData.total);
            $("#addForm_orderNo").val(myData.total*1+1);
        }
    });
}

/**** Part 四、以下是自定义新增方法  ****/
//1.定义校验规则-定义
function setValidate(id) {
    $(id).each(function () {
        $(this).bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            }, /** 以下需要结合实际业务清空补充个表单元素的验证规则 **/
            fields: {
                 "sysModule.title": {
                     validators: {
                         notEmpty: {
                             message: '名称不能为空！'
                         }
                     }
                 },
				"sysModule.code":{
                    validators: {
                        notEmpty: {
                            message: '标识不能为空！'
                        },
                        regexp: {
                            regexp: /^[a-z][a-z0-9_-]*$/,
                            message: '必须由小写字母、数字、下划线、横线组成，且只能以字母开头！'
                        }
                    }
				},
                "sysModule.menuIcon":{
                    validators: {
                        regexp: {
                            regexp: /^[a-zA-Z_0-9 -]+$/,
                            message: '注意格式，请查看右侧说明！'
                        }
                    }
                },
				"sysModule.ifShow":{
                    validators: {
                        notEmpty: {
                            message: '此项不能为空！'
                        }
                    }
				},
				"sysModule.orderNo":{
                    validators: {
                        notEmpty: {
                            message: '此项不能为空！'
                        },
                        regexp: {
                            regexp: /^[0-9]+$/,
                            message: '必须由数字组成'
                        }
                    }
				}
            }
        });
    });
}

//判断是否第一次进入，启用步骤引导提示
function initGuideIntroJs() {
    if(strUtil.isNull(strUtil.getLocalStorage("_iussoft_intro_project_module"))){
        strUtil.setLocalStorage("_iussoft_intro_project_module","T");
        showGuideIntroJs();
    }
//    var _cookie_intro_flag= $.cookie('_iussoft_intro_project_module');
//    //console.log("_iussoft_intro_project_module",_cookie_intro_flag);
//    if(strUtil.isNull(_cookie_intro_flag)){
//        $.cookie('_iussoft_intro_project_module', "T");
//        showGuideIntroJs();
//    }
}

</script>

    
    
  </div>
  <!-- /.content-wrapper -->
  <!-- foot start -->
	<#include "/common/plateform/foot.ftl">
  <!-- foot start -->
</div>
</body>

</html>
